<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateContentTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('content', function (Blueprint $table) {
            $table->increments('id');
            $table->string("title")->nullable()->comment("标题");
            $table->string("desc")->nullable()->comment("描述");
            $table->text("info")->nullable()->comment("内容");
            $table->integer("classify_id")->default(0)->comment("分类id");
            $table->timestamps();
            $table->softDeletes();
        });

        Schema::create('content_x_user', function (Blueprint $table) {
            $table->increments('id');
            $table->integer("content_id")->default(0)->comment("内容id");
            $table->integer("user_id")->default(0)->comment("用户id");
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('content');
    }
}
